#include "field.h"

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int tmp;
	scanf("%x", &tmp);
	if(tmp <0 || tmp >= 256)
	{
		printf("Range must be (1,255)!\n");
	}
	int inverse = 0;
	for(inverse = 0; inverse <= 0xff; ++inverse)
	{
		if(gf_256_11b_mul(tmp, inverse) == 0x1)
		{
			break;
		}
	}
	printf("%.2x\n", inverse);

	int i;
	for(i = 0; i <= 0xff; ++i)
	{
		for(inverse = 0; inverse <= 0xff; ++inverse)
		{
			if(gf_256_11b_mul(i, inverse) == 0x1)
			{
				break;
			}
		}
		if(i % 16 == 0)
			printf("\n");
		printf("0x%.2x,",inverse);
	}

	return 0;
}
